# -*- coding:utf-8 -*-
# @FileName  :dhcc_per_business_params.py
# @Time      :2020/12/7 17:12
# @Author    :Zhoujirong
# @Desc      :个人业务参数
import time
from biz.flow.per_business_params import PerBusinessParamsRequest
from common.log import Log
from biz.cases.base_case import BaseCase


class TestPerBusinessParams(BaseCase):
    data_file_name = 'per_buiness_params.yaml'
    @classmethod
    def setUpClass(cls):
        cls.cookie = BaseCase().get_token()

    def test_detail(self):
        '''查看详情'''
        configid = self.file_data.get('configid')
        check = self.file_data.get('configDesc_check')
        ret = PerBusinessParamsRequest.business_params_detail(configid,self.cookie)
        Log.info(ret)
        self.assertIn(check,ret.configDesc)

    def test_getpage(self):
        '''检索'''
        curPage = self.file_data.get('curPage')
        maxSize = self.file_data.get('maxSize')
        search_LIKE_configName = self.file_data.get('search_LIKE_configName')
        search_LIKE_configDesc = self.file_data.get('search_LIKE_configDesc')
        ret = PerBusinessParamsRequest.business_params_getpage(curPage,maxSize,
                                                               search_LIKE_configName,
                                                               search_LIKE_configDesc,
                                                               self.cookie)
        Log.info(ret)
        self.assertEqual(1,len(ret.list))

    def test_update(self):
        '''业务参数编辑'''
        configDesc = self.file_data.get('configDesc')
        configId = '0107'
        configName = self.file_data.get('configName')
        configValue = self.file_data.get('configValue')
        createTime = self.file_data.get('createTime')
        createUser = self.file_data.get('createUser')
        ext1 = self.file_data.get('ext1')
        ext2 = self.file_data.get('ext2')
        ext3 = self.file_data.get('ext3')
        ext4 = self.file_data.get('ext4')
        ext5 = self.file_data.get('ext5')
        ext6 = self.file_data.get('ext6')
        orgId = self.file_data.get('orgId')
        resCode = self.file_data.get('resCode')
        resMsg = self.file_data.get('resMsg')
        serialNumber = self.file_data.get('serialNumber')
        updateTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
        updateUser = self.file_data.get('updateUser')
        ret = PerBusinessParamsRequest.business_params_update(configDesc,configId,configName,configValue,
                                    createTime,createUser,ext1,ext2,ext3,ext4,
                                    ext5,ext6,orgId,resCode,resMsg,serialNumber,
                                    updateTime,updateUser,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000',ret.code)
        self.assertIn('操作成功',ret.msg)


if __name__ == "__main__":
    pass